package com.bw.controller;

import com.bw.entity.Bing;
import com.bw.entity.Dict;
import com.bw.entity.Zhexiantu;
import com.bw.mapper.JobMapper;
import org.spring.kun.common.ExcelUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller

public class EchartsController {

    @Autowired
    JobMapper jobMapper;


    @RequestMapping("/echartsPage.do")
    public String echartsPage(Model model) {
        //  渲染职级下拉框
        List<Dict> list = jobMapper.listGrade();

        model.addAttribute("gradeList",list);
        return "echartsPage";
    }


    @RequestMapping("/zxt.do")
    @ResponseBody
    public List<Zhexiantu> zxt(Integer zhiji,String miaoshu) {

       List<Zhexiantu>  list = jobMapper.zxtByParam(zhiji,miaoshu);

        return list;
    }

    @RequestMapping("/excel.do")
    public void excel(Integer zhiji,String miaoshu,HttpServletResponse response) {

       List<Zhexiantu>  list = jobMapper.zxtByParam(zhiji,miaoshu);

        ExcelUtils.exportExcel(list,"岗位统计导出","sheet1",response);
    }





}
